<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增培训经历')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-training-add" class="form-horizontal" AUTOCOMPLETE="OFF">
        <input name="id" type="hidden" id="id" th:value="${id}"/>
        <h4 class="form-header h4">培训经历</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训类型：</label>
                    <div class="col-sm-8">
                        <select name="Traintype" id="Traintype" class="form-control m-b"
                                th:with="type=${@dict.getType('tCD_TrainType')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select></div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训形式：</label>
                    <div class="col-sm-8">
                        <select name="TrainKind" id="TrainKind" class="form-control m-b"
                                th:with="type=${@dict.getType('tCD_TrainKind')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select></div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训主题：</label>
                    <div class="col-sm-8">
                        <input name="content" id="content" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训课程：</label>
                    <div class="col-sm-8">
                        <input name="Course" id="Course" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>


        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">开始时间：</label>
                    <div class="col-sm-8">
                        <input name="BeginDate" id="BeginDate" class="form-control laydate-demo-1" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">结束时间：</label>
                    <div class="col-sm-8">
                        <input name="EndDate" id="EndDate" class="form-control laydate-demo-2" type="text"/>
                    </div>
                </div>
            </div>
        </div>


        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训地点：</label>
                    <div class="col-sm-8">
                        <input name="place" id="place" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">举办机构：</label>
                    <div class="col-sm-8">
                        <input name="Vendor" id="Vendor" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">课时：</label>
                    <div class="col-sm-8">
                        <input name="Hours" id="Hours" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">所获证书：</label>
                    <div class="col-sm-8">
                        <input name="Certificate" id="Certificate" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">证书编号：</label>
                    <div class="col-sm-8">
                        <input name="CertificateNo" id="CertificateNo" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">备注：</label>
                    <div class="col-sm-8">
                        <input name="Remark" id="Remark" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "entryManage/EntryBackground";

    $(function () {

        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-2',
                type: 'date'
            });
        });
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-training-add").serializeArray();

            var id = $("#id").val();
            var Traintype = $("#Traintype").val();
            var TrainKind = $("#TrainKind").val();
            var content = $("#content").val();
            var Course = $("#Course").val();
            var BeginDate = $("#BeginDate").val();
            var EndDate = $("#EndDate").val();
            var place = $("#place").val();
            var Vendor = $("#Vendor").val();
            var Hours = $("#Hours").val();
            var Certificate = $("#Certificate").val();
            var CertificateNo = $("#CertificateNo").val();
            var Remark = $("#Remark").val();


            data.push({"name": "id", "value": id});
            data.push({"name": "Traintype", "value": Traintype});
            data.push({"name": "TrainKind", "value": TrainKind});
            data.push({"name": "content", "value": content});
            data.push({"name": "Course", "value": Course});
            data.push({"name": "BeginDate", "value": BeginDate});
            data.push({"name": "EndDate", "value": EndDate});
            data.push({"name": "place", "value": place});
            data.push({"name": "Vendor", "value": Vendor});
            data.push({"name": "Hours", "value": Hours});
            data.push({"name": "Certificate", "value": Certificate});
            data.push({"name": "CertificateNo", "value": CertificateNo});
            data.push({"name": "Remark", "value": Remark});
            $.operate.save(prefix + "/addTraining", data);
        }
    }


</script>
</body>
</html>
